package network;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

public class UdpDicServer extends UdpEchoServer {
    private Map<String,String> dict = new HashMap<>();


    public UdpDicServer(int port) throws SocketException {
        super(port);
        dict.put("dog","小狗");
        dict.put("cat","小猫");
        dict.put("fuck","握草");
        dict.put("nice","漂亮的");
        dict.put("beautiful","漂亮的");
    }

    @Override
    public String process(String request) {
        return dict.getOrDefault(request,"该单词没有查到");
    }

    public static void main(String[] args) throws IOException {
        UdpDicServer udpDicServer = new UdpDicServer(9090);
        udpDicServer.start();
    }

}
